package com.summer.framework.common.entity.response;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @auther: 杨杰
 * @date: 2019/1/14 14:17
 * @description:
 */
@Data
@NoArgsConstructor
public class BooleanResponse<Boolean> extends BaseResponse {
    private boolean data;

    public BooleanResponse(Integer status, String message, boolean data) {
        super(status, message);
        this.data = data;
    }

    public boolean data() {
        return data;
    }

    public BooleanResponse(Integer status, boolean data) {
        this(status, "", data);
    }

    public BooleanResponse(String message, boolean data) {
        super(message);
        this.data = data;
    }

    public BooleanResponse(boolean data) {
        this.data = data;
    }


    public static final class BooleanResponseBuilder {
        private boolean data;
        private Integer status;
        private String message;

        private BooleanResponseBuilder() {
        }

        public static BooleanResponseBuilder aBooleanResponse() {
            return new BooleanResponseBuilder();
        }

        public BooleanResponseBuilder data(boolean data) {
            this.data = data;
            return this;
        }

        public BooleanResponseBuilder status(Integer status) {
            this.status = status;
            return this;
        }

        public BooleanResponseBuilder message(String message) {
            this.message = message;
            return this;
        }

        public BooleanResponse build() {
            BooleanResponse booleanResponse = new BooleanResponse(data);
            booleanResponse.setStatus(status);
            booleanResponse.setMessage(message);
            return booleanResponse;
        }
    }
}
